<template>
	<view>
		<view class="input">
			<input type="text" placeholder="请输入卡号" 
				v-model="params.cardNumber" />
		</view>
		<view class="input">
			<input type="text" placeholder="输入密码"
				v-model="params.cardPwd" />
		</view>
		
		<view class="footerbtn">
			<view class="cont" @click="handlebd">
				<view class="btn">
					绑定
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		cardReplace
	} from '@/common/http.api.js';
	export default {
		data() {
			return {
				params:{
					cardNumber:'',
					cardPwd:""
				}
			};
		},
		methods: {
			handlebd(){
				if(this.params.cardNumber == ''){
					uni.showToast({
						icon:'none',
						title:'卡号不能为空'
					})
					return
				}
				if(this.params.cardPwd == ''){
					uni.showToast({
						icon:'none',
						title:'密码不能为空'
					})
					return
				}
				cardReplace(this.params).then(res=>{
					console.log(res);
					if(res.code == 200){
						uni.showToast({
							icon:'none',
							title:'绑定成功'
						})
						setTimeout(()=>{
							uni.navigateBack()
						},1000)
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.input {
		width: 670rpx;
		height: 100rpx;
		background: #FBFBFB;
		border-radius: 20rpx 20rpx 20rpx 20rpx;
		margin: 20rpx auto;
		display: flex;
		align-items: center;
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		font-size: 28rpx;
		color: #000000;
		padding: 0rpx 20rpx;
		box-sizing: border-box;

		input {
			flex: 1;
		}
	}

	.footerbtn {
		width: 750rpx;
		height: 120rpx;
		background: #FFFFFF;

		.cont {
			display: flex;
			padding: 10rpx 20rpx;
			height: 120rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 32rpx;
			align-items: center;
			justify-content: center;
			.btn {
				width: 670rpx;
				height: 100rpx;
				background: #000000;
				border-radius: 8rpx 8rpx 8rpx 8rpx;
				color: #FFFFFF;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 32rpx;
				color: #FFFFFF;
				line-height: 100rpx;
				text-align: center;
			}
			.absbtn{
				background: #808080;
			}
		}
	}
</style>